<%@page import="openAPI.NaverImage"%>
<%@page import="java.net.URLDecoder"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="openAPI.NaverImage" import="java.util.*" %>

<%
request.setCharacterEncoding("UTF-8");
String query = request.getParameter("query");

//한글일 경우
String dQuery = URLDecoder.decode(query, "EUC-KR");

NaverImage image = new NaverImage();
	
String data = image.naverImage(query);

int count=image.getItemCount(data);

String[] title = new String[count+1];
String[] link = new String[count+1];

title = image.dataList(data, "title");
link = image.getHTTP(data, "link");


for(int i=0; i<title.length;i++){
	if(i==0)
		continue;
	else{%>
		<%=title[i] %><br>
		<img src="<%=link[i]%>"><br><br>
	<%}
	
	}%>
